package com.cindata

class CommunityScoreWeight
{

    BigDecimal liquidityWeight
    // 流动性权重
    BigDecimal assortWeight
    // 配套权重
    BigDecimal natureWeight
    // 配套权重

    // 流动性详细权重

    BigDecimal closingWeight
    // 成交率权重
    BigDecimal dealAvgDayWeight
    // 成交周期权重
    BigDecimal listingWeight
    // 挂牌率权重
    BigDecimal discountrateWeight
    // 折价比权重
    BigDecimal foreclosureTimesWeight
    // 法拍次数权重

    // 配套详细权重

    BigDecimal schoolDistrictsWeight
    // 学区权重
    BigDecimal trafficWeight
    // 交通权重
    BigDecimal houseAgeWeight
    // 房龄权重
    BigDecimal hospitalWeight
    // 医院权重
    BigDecimal mallWeight
    // 商场权重
    BigDecimal afforestationWeight
    // 绿化率权重
    BigDecimal ratioWeight
    // 容积率权重
    BigDecimal parkWeight
    // 公园权重
    BigDecimal propertyFeeWeight
    // 物业费权重
    BigDecimal superMarketWeight
    // 超市权重
    BigDecimal bankWeight
    // 银行权重

    //自然环境评分
    //景区权重
    BigDecimal scenicWeight
    // 噪音污染权重
    BigDecimal noisePullutionWeight
    // 空气污染权重
    BigDecimal airPullutionWeight

    static mapping = {
        autowire true
    }

    static constraints = {
        liquidityWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '流动性权重'
        assortWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '成交率权重'
        natureWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '自然评分权重'

        closingWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '成交率权重'
        dealAvgDayWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '成交周期权重'
        listingWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '挂牌率权重'
        discountrateWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '折价比权重'
        foreclosureTimesWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '法拍次数权重'


        schoolDistrictsWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '学区权重'
        trafficWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '交通权重'
        houseAgeWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '房龄权重'
        hospitalWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '医院权重'
        mallWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '商场权重'
        afforestationWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '绿化率权重'
        ratioWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '容积率权重'
        parkWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '公园权重'
        propertyFeeWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '物业费权重'
        superMarketWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '超市权重'
        bankWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '银行权重'

        scenicWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '景区权重'
        noisePullutionWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '噪音污染权重'
        airPullutionWeight precision: 6, scale: 4, nullable: true, blank: true, comment: '空气污染权重'
    }

    static initData()
    {
        if (CommunityScoreWeight.count() < 1)
        {
            def csw = new CommunityScoreWeight()
            csw.liquidityWeight = 0.4
            csw.assortWeight = 0.33
            csw.natureWeight = 0.27

            csw.closingWeight = 0.29
            csw.dealAvgDayWeight = 0.23
            csw.listingWeight = 0.19
            csw.discountrateWeight = 0.16
            csw.foreclosureTimesWeight = 0.13

            csw.schoolDistrictsWeight = 0.204
            csw.trafficWeight = 0.167
            csw.houseAgeWeight = 0.137
            csw.hospitalWeight = 0.112
            csw.mallWeight = 0.092
            csw.afforestationWeight = 0.075
            csw.ratioWeight = 0.061
            csw.parkWeight = 0.05
            csw.propertyFeeWeight = 0.041
            csw.superMarketWeight = 0.034
            csw.bankWeight = 0.027

            csw.scenicWeight = 0.4
            csw.noisePullutionWeight = 0.33
            csw.airPullutionWeight = 0.27

            csw.save()
        }
    }
}
